# $Id: PKGBUILD 183357 2013-04-21 22:09:09Z heftig $
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=fontconfig
pkgver=2.10.92
pkgrel=4
pkgdesc="A library for configuring and customizing font access"
arch=(i686 x86_64)
url="http://www.fontconfig.org/release/"
license=('custom')
depends=('expat' 'freetype2')
options=('!libtool')
install=fontconfig.install
source=(http://www.fontconfig.org/release/$pkgname-$pkgver.tar.bz2
        29-replace-bitmap-fonts.conf git_fixes.diff)
sha256sums=('1162059927120f2321f12917189b524e6b2f09e11ac643278d0bb82634035b22'
            '2325c478783659e8fce79f5754119934d6ce21f81552f878b740c7b18f9fe0d6'
            '7dc98137405ee0e5f98f3266a760a4da27d78e3c2bc7b7ef4db6b481df3c39f0')

  # a nice page to test font matching:
  # http://zipcon.net/~swhite/docs/computers/browsers/fonttest.html

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # post release fixes
  patch -Np1 -i ${srcdir}/git_fixes.diff

  # make sure there's no rpath trouble and sane .so versioning - FC and Gentoo do this as well
  libtoolize -f
  autoreconf -fi

  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --with-templatedir=/etc/fonts/conf.avail \
    --with-xmldir=/etc/fonts \
    --localstatedir=/var \
    --disable-static \
    --with-default-fonts=/usr/share/fonts \
    --with-add-fonts=/usr/share/fonts
  make
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  make -k check
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install

  install -m644 "$srcdir/29-replace-bitmap-fonts.conf" "$pkgdir/etc/fonts/conf.avail"
  ln -s ../conf.avail/29-replace-bitmap-fonts.conf \
    "$pkgdir/etc/fonts/conf.d/29-replace-bitmap-fonts.conf"

  #Install license
  install -m755 -d "$pkgdir/usr/share/licenses/$pkgname"
  install -m644 COPYING "$pkgdir/usr/share/licenses/$pkgname"
}
